package cn.hchaojie.javase.day03;

import org.junit.Test;

public class Demo2DArray {
	@Test
	public void test1() {
		int[] english = { 50, 55, 53, 66, 32 };
		int[] math = { 121, 101, 98, 118, 134 };
		int[] politic = { 60, 50, 40, 57, 55 };
		
		int[][] scores = {
				{ 50, 55, 53, 66, 32 },
				{ 121, 101, 98, 118, 134 },
				{ 60, 50, 40, 57, 55 }
		};
		
		System.out.println(scores[0][0]);
		
		System.out.println(scores[1][2]);
		
		// 如何取内层的数组
		int[] english1 = scores[0];				// 取第一行所有数据
	}
	
	@Test
	public void test2() {
		// 定义一个三行五列的数组
		int[][] array = new int[3][5];
		
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 5; j++) {
				array[i][j] = 1;
			}
		}
		
		System.out.println(array.length);
	}
}
